<template>
  <view class="flex-1">
    <!-- #ifdef MP-WEIXIN -->
    <view v-if="state.latitude" class="aaaaa">
      <map
        :scale="4.5"
        :longitude="state.longitude"
        :latitude="state.latitude"
        :markers="state.covers"
        @markertap="handleMarkerTap"
        style="width: 100%; height: 1068rpx"
        class="relative"
      >
        <cover-view
          class="controls-title absolute left-[10rpx]"
          :style="{ top: customNavStyle.menuButtonTop * 2 + 'rpx' }"
        >
          <cover-view
            class="w-[214rpx] bg-[#FFFFFF] h-[64rpx] flex justify-center items-center rounded-[37rpx]"
          >
            <cover-image
              src="@/static/hangkong.png"
              class="w-[174rpx] h[54rpx]"
            ></cover-image>
          </cover-view>
        </cover-view>
        <cover-view
          class="w-full h-[132rpx] bg-white absolute -bottom-5"
          style="border-radius: 32rpx 32rpx 0 0"
        >
          <cover-view
            class="text-theme text-[36rpx] text-center pt-[60rpx]"
            style="font-weight: 900"
          >
            凤之翼公务航空
          </cover-view>
        </cover-view>
      </map>
    </view>
    <!-- #endif -->
    <view class="w-full bg-white px-5">
      <view class="text-[#7E8492] text-xl leading-[52rpx] text-justify pt-5"
        >凤之翼公务航空是一家提供私人航空领域解决方案与配套咨询服务的专业航空公司，主要面向于高端企业客户及个人客户在进行私人飞机购买、租赁、融资、包机、飞机管家、二手机处置、资产管理过程中针对不同个性化需求提供全面有效的解决方案与服务。</view
      >
      <image
        class="w-full h-[292rpx] rounded-lg mt-[70rpx]"
        src="https://ykx-1254116920.cos.ap-nanjing.myqcloud.com/aircraft/fly/fly-3.png"
        mode="widthFix"
      ></image>
      <view
        class="text-theme text-[36rpx] font-bold text-center pt-[78rpx] leading-[58rpx]"
      >
        <view>团队人员累计已完成150架公务机 </view>
        <view>的融资贷款和近90架飞机的交易</view>
      </view>
      <view class="text-[#7E8492] text-xl leading-[56rpx] text-justify mt-3"
        >服务内容包括不限于境内外飞机采购分析，租售对比分析，产权共享解决，税务筹划分析，境内外融资安排，合同谈判，税务筹划，飞机注册，报关引进，飞机托管、再销售及置换，运力利用与解决及对外包机等私人航空领域的。</view
      >
      <image
        class="w-full h-[484rpx] rounded-lg mt-[92rpx]"
        src="https://ykx-1254116920.cos.ap-nanjing.myqcloud.com/aircraft/fly/WechatIMG24558.jpg"
        mode="widthFix"
      ></image>
      <view
        class="text-theme text-[36rpx] font-bold text-center pt-[60rpx] leading-[58rpx]"
      >
        <view>全球可调配的私人</view>
        <view>领域包机资源近2000架</view>
      </view>
      <view class="text-[#7E8492] text-xl leading-[56rpx] text-justify mt-3">
        <view
          >涉及机型涵盖湾流、庞巴迪、达索、波音、空客、塞斯纳、巴航工业等各种品牌。</view
        >
      </view>
	  <image
	    v-if="settingInfo.switchSale == 1"
	    @click="goHot"
	    class="w-full h-[292rpx] rounded-[20rpx] mt-[64rpx] mb-5"
	    src="https://ykx-1254116920.cos.ap-nanjing.myqcloud.com/aircraft/WechatIMG24995.jpg"
	    mode="widthFix"
	  ></image>
      <view
        class="text-theme text-[36rpx] font-bold text-center pt-[20rpx] leading-[58rpx]"
      >
        <view>关注我们的公众号</view>
      </view>
      <view class="text-[#7E8492] text-xl leading-[56rpx] text-center mt-3">
        <view>关注我们的公众号“凤之翼公务航空”，</view>
        <view> 带您了解不一样的公务航空。</view>
      </view>
      <!-- <image src="@/"></image> -->
      <view
        class="flex justify-center w-full"
        :class="settingInfo.switchSale == 1 ? '' : 'pb-[64rpx]'"
      >
        <image
          show-menu-by-longpress
          class="w-[346rpx] h-[346rpx] mt-[30rpx]"
          src="https://ykx-1254116920.cos.ap-nanjing.myqcloud.com/aircraft/WechatIMG24578.jpg"
          mode="widthFix"
        ></image>
      </view>
      
    </view>
    <customTab value="index" />
  </view>
</template>

<script setup>
import { getAirPorts_api } from "@/api/index";
import { ref, computed, reactive } from "vue";
import { useUserStore } from "@/stores/user.js";
import { onShow, onShareAppMessage } from "@dcloudio/uni-app";
const userStore = useUserStore();
const settingInfo = computed(() => userStore.setting);

const list = ref([]);
const getList = () => {
  getAirPorts_api().then((res) => {
    list.value = res;
    state.covers = res.map((e) => {
      return {
        id: e.id,
        latitude: e.lat,
        longitude: e.lng,
        iconPath: "/static/mark.png",
        width: "26rpx",
        height: "34rpx",
      };
    });
  });
};
onShow(() => {
  getList();
});
const systemInfo = uni.getSystemInfoSync();
// #ifdef MP
// 获取胶囊按钮位置信息
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();

// 计算导航栏高度（状态栏高度 + 胶囊按钮高度 + 上下边距）
const navHeight =
  menuButtonInfo.bottom + menuButtonInfo.top - systemInfo.statusBarHeight;

const customNavStyle = computed(() => {
  return {
    navHeight: navHeight,
    menuButtonTop: menuButtonInfo.top,
    menuButtonHeight: menuButtonInfo.height,
  };
});
// #endif
const goHot = () => {
  uni.navigateTo({
    url: "/pages/index/hotAir",
  });
};

const state = reactive({
  latitude: 33.94469,
  longitude: 108.643951,
  covers: [
    {
      id: 1,
      latitude: "",
      longitude: "",
      iconPath: "/static/mark.png",
      width: "26rpx",
      height: "33rpx",
    },
  ],
});
const handleMarkerTap = (e) => {
  uni.navigateTo({
    url: "/pages/index/planeInfo?id=" + e.detail.markerId,
  });
};

onShareAppMessage(() => {
  return {
    title: "私人飞机买卖、包机、咨询，专业团队为您提供全流程服务",
    path: "/pages/index/index",
    imageUrl: settingInfo.value.shareImg,
  };
});


</script>
